package initialize

import (
	"fmt"
	"github.com/elastic/go-elasticsearch/v7"
	"os"
	"strings"
)

func MustNewElasticSearch(dsn string) *elasticsearch.Client {
	cfg := elasticsearch.Config{
		Addresses: strings.Split(dsn, ","),
	}
	client, err := elasticsearch.NewClient(cfg)
	if err != nil {
		fmt.Println("es链接失败:", err)
		os.Exit(-1)
	}
	return client
}
